package edu.webtek.cloudresp;

import java.util.ArrayList;
import java.util.Iterator;

import org.jdom2.Document;
import org.jdom2.Element;

import edu.webtek.clouddata.Customer;

public class RespCustomers extends RespBase implements Iterable<Customer>{
	final private ArrayList<Customer> customers = new ArrayList<Customer>();

	public RespCustomers(Document custommers) {
		if(custommers == null){
			flagResponseError();
			return;
		}
		for(Element customer : custommers.getRootElement().getChildren()){
			this.customers.add(new Customer(customer));
		}
	}
	
	@Override
	public Iterator<Customer> iterator() {
		return customers.iterator();
	}
}